\begin{tikzpicture}[-stealth,scale=1.6,transform shape,node distance = 1em]
	\tikzstyle{every node}=[font=\small,scale=0.8]
	\begin{scope}[minimum height = 1pt]
		\tikzstyle{inout}=[trapezium, trapezium left angle=60, trapezium right angle=120, draw] %%输入输出框
		\tikzstyle{point}=[coordinate,on grid,] % 像素点,用于连接转移线
		\tikzstyle{mid}=[rectangle,  opacity=0,draw] 
		\tikzstyle{end}=[rectangle, rounded corners, draw]   %%教材上的起止框
		\tikzstyle{endn}=[rounded rectangle, draw]   %%新版的起止框
		\tikzstyle{exec}=[rectangle, draw]    %%执行框 execute
		\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text centered, draw=black]  % 平行四边形
		\tikzstyle{decide}=[diamond,aspect=2,draw,thin]   %%判断框 opacity=0.3

		% 节点 直线
		\node[end](s) at (0, 0) {\color{blue}开始};
		\node[anchor=south,inner sep=2pt] (m1) at ([yshift=-2em]s.south) {\color{blue}state$:=1$};
		\node[anchor=south,inner sep=2pt] (m2) at ([yshift=-2em]m1.south) {\color{blue}Semfun(state)};
		\node[anchor=south,inner sep=2pt] (m3) at ([yshift=-2em]m2.south) {\color{blue}getchar(ch)};
		\node [exec,align=center] (e1) at ([yshift=-2em]m3.south) {\color{blue}查变换表:  \\ \color{blue}$\delta(state, ch)=?$};
		\node[decide] (d1) [below = of e1] {\color{blue}$\delta=\varepsilon$};
		\node[decide] (d2) [below = of d1] {\color{blue}$\delta=ok$};
		\node[anchor=south,inner sep=2pt] (m4) at ([yshift=-2em]d2.south) {\color{blue}计算:$num=n*10^{e*p-m}$};
		\node[end] (end) at  ([yshift=-2em]m4.south) {\color{blue}结束};
		
		
		
		% 右边
		\node [exec,align=center] (e2) at ([xshift=2em]d1.east) {\color{blue}state$:=\delta$};
		
		
		% 左边
		\node [io](io) at ([xshift=-4em,yshift=-2em]d1.west) {\color{blue}回答:no};
		\node (text2) at([xshift=-2.5em,yshift=-1em]end.south) {(b)主控程序};
		
		% 连线 
		\draw (s) -- (m1.north);
		\draw (m1.south) -- (m2.north);
		\draw (m2.south) -- (m3.north);
		\draw (m3.south) -- (e1.north);
		\draw (e1.south) -- (d1.north);
		\draw (d1.south) -- (d2.north);
		\draw (d2.south) -- (m4.north);
		\draw (m4.south) -- (end.north);
		% 左边斜线
		\draw [-] (d1.west) -| (io.north);
		\draw (io.south) |- ([yshift=-1em]m4.south);
		% 右边斜线
		\draw [-] (d2.east) -| (e2.south);
		\draw (e2.north) |- ([yshift=-0.5em]m1.south);
		
	\end{scope}
	
\end{tikzpicture}